clear
import excel "/Users/gwynethmcclendon/Dropbox/Paper AA-GM/Replication materials Overtly Religious Appeals JOP/Study1.xlsx", sheet("Survey_March 23, 2021_18.19") firstrow

destring, replace

**Treatments**

*Generate numeric message treatments and dummies for each
encode message, gen(message_treat)
gen message_multi=0
recode message_multi (0=1) if message_treat==1

gen message_overt=0
recode message_overt (0=1) if message_treat==2

gen message_sec=0
recode message_sec (0=1) if message_treat==3

gen message_rel=0
replace message_rel=1 if message_treat==1 | message_treat==2

**Code outcome variables**

*Generate Support for candidate 
gen candsupport=support
replace candsupport= AT if candsupport==.
replace candsupport= AZ if candsupport==.

*Generate candidate qualified
gen candqualified= qualified
replace candqualified= AU if candqualified==.
replace candqualified= BA if candqualified==.

*Generate candidate represents
gen candrepresent=represent
replace candrepresent=AV if candrepresent==.
replace candrepresent=BB if candrepresent==.

*Generate candidate religious
gen candreligious=religious
replace candreligious= AW if candreligious==.
replace candreligious=BC if candreligious==.

*Generate candidate eloquent
gen candeloquent= eloquent
replace candeloquent= AX if candeloquent==.
replace candeloquent= BD if candeloquent==.


*Generate candidate thoughtful
gen candthoughtful=thoughtful
replace candthoughtful=AY if candthoughtful==.
replace candthoughtful=BE if candthoughtful==.

**measure of compliance with dangers treatment***
sum danger_takeup if dangers==1


**Code democratic covariates**

*Rename Religious
rename Religious responrelig

*Generate Christian Nationalism scale (Note that cnat_5 is not included because it was an attention check and cnat_3 is reverse coded)
gen cnat= cnat_1+ cnat_2+6- cnat_3+ cnat_4+ cnat_6+ cnat_7
sum cnat
sum cnat, d
gen high_cnat=0
replace high_cnat=1 if cnat>19 & cnat~=.
replace high_cnat=. if cnat==.
tab responrelig high_cnat


*Generate party numeric (note that this includes leaners)
encode Party, gen(party_num)
gen democrat=0
replace democrat=1 if party_num==1
gen republican=0 
replace republican=1 if party_num==2

tab responrelig republican, row

*For pure partisans use these variable
gen democratpid=1 if pid1==1
recode democratpid (.=0)

gen republicanpid=1 if pid1==2
recode republicanpid (.=0)

gen independentpid=1 if pid1==3
recode independentpid (.=0)


recode pid1 (1=1) (2=3) (3=2), gen(pid_reordered)
label define pidlabel 1 "Democrat" 2 "Independent" 3 "Republican" 
label values pid_reordered pidlabel

*Age
gen age=2021-year_born

*Race
split race, p(",")
destring race1 race2 race3 race4, replace

gen asian=1 if race1==1 
recode asian (.=0)
gen black=1 if race1==2 
recode black (.=0)
gen nativeamerican=1 if race1==3 
recode nativeamerican (.=0)
gen white=1 if race1==4 
recode white (.=0)
gen other=1 if race1==5 
recode other (.=0)
gen mixedrace=1 if race2!=.
recode mixedrace (.=0)

recode latino (2=0)

*Gender
recode gender (1=0) (2=1) (3 4=.), gen(female)

*Education
gen college=0 if educ==1 | educ==2 | educ==3 | educ==4
replace college=1 if educ==5 | educ==6 |educ==7

*Political participation
gen evervoted=0
replace evervoted=1 if voted_ever==1

recode voted_2020 (2=0)

recode voted_2020 (.=0) if evervoted==0

recode workpols (2=0)

*Religiosity
recode oftenservices (1=5) (2=4) (3=3) (5=1) (4=2), gen(oftenservices_reordered)
label define oftenserviceslabel 1 "Never" 2 "A Few Times a Year" 3 "Once or Twice a Month" 4 "Almost Every Week" 5 "Every week"
label values oftenservices_reordered oftenserviceslabel

gen veryreligious=0
replace veryreligious=1 if oftenservices_reordered==4 | oftenservices_reordered==5

gen mostreligious=0
replace mostreligious=1 if oftenservices_reordered==5

gen childrelig=.
replace childrelig=1 if often12==1 | often12==2 | often12==3
replace childrelig=0 if often12==4 | often12==5 

gen believeingod=.
replace believeingod=1 if deitybelief==1 | deitybelief==2 | deitybelief==3
replace believeingod=0 if deitybelief==4 | deitybelief==5 | deitybelief==6 | deitybelief==7

recode deitybelief (1 2 3 4 =1) (5 6 7=0), gen(spiritual)

recode deitybelief (1=1) (2 3 4 5 6 7 =0), gen(beliefgodnodoubts)

gen mostfervent=0
replace mostfervent=1 if beliefgodnodoubts==1 & oftenservices==1

gen somehoursreligious=.
replace somehoursreligious=1 if timereligious>1 & timereligious~=.
replace somehoursreligious=0 if timereligious==1 

gen timereligious_rev=.
replace timereligious_rev=timereligious if timereligious>1 & timereligious~=.
replace timereligious_rev=0 if timereligious==1 

tab spiritual responrelig /*78% of people who don't attend regularly are nevertheless spiritual*/

gen supersecular=0
replace supersecular=1 if responrelig==0 & somehoursreligious==0 & beliefgodnodoubts==0

gen superreligious=0
replace superreligious=1 if responrelig==1 & somehoursreligious==1 & beliefgodnodoubts==1

*Region
recode region (2 3 4=0), gen(northeast)
recode region (2=1) (1 3 4=0), gen(midwest)
recode region (3=1) (1 2 4=0), gen(south)
recode region (4=1) (1 2 3=0), gen(west)

*Denomination
tab religion, gen(denom)
rename denom1 catholic
rename denom2 mainline
rename denom3 evangelical
rename denom4 otherchristian
rename denom5 agnostic
rename denom6 atheist
rename denom7 none

gen notrelig=agnostic+atheist+none

*Attention check question
gen inattentive=1
replace inattentive=0 if cnat_5==5 
replace inattentive=. if cnat_5==.


****Compliance with Dangers Prompt***
gen compliance_coder1=danger_takeup

gen compliance_coder2=0
replace compliance_coder2=1 if compliance_julieta==1

gen compliance_coder3=0
replace compliance_coder3=1 if compliance_lexi_redone==1

gen compliance_dangers=0
replace compliance_dangers=1 if compliance_coder1==1 & compliance_coder2==1 & compliance_coder3==1

***************
***Tables and Figures***
**************
set scheme s2color

**Figure 1: Sample Characteristics, with comparison to ANES
***See code at the end of the do file**

** Figure 2: Distribution of Religious Attendance
gen religiosity=oftenservices
recode religiosity (.=0) (1=5) (2=4) (3=3) (4=2) (5=1)
label define attendance 0 "Not religious" 1 "Never" 2 "A few times a year" 3 "Once or twice a month" 4 "Almost every week" 5 "Every week"
label values religiosity attendance
graph bar, over(religiosity, lab(angle(45))) intensity(60) 



*Figure 5: Changes in Candidate Evaluations Following the Overtly Religious Message and Dangers Prime, Among the Religious
label define dangerslabel 0 "No Reflection" 1 "Dangers Reflection"
label values dangers dangerslabel
label define overtlabel 0 "Multi/Secular Message" 1 "Overtly Religious Message"
label values message_overt overtlabel
reg candsupport i.dangers##i.message_overt if responrelig==1, robust
estimates store support1
reg candqualified i.dangers##i.message_overt if responrelig==1, robust
estimates store qualified1
reg candrepresent i.dangers##i.message_overt if responrelig==1, robust
estimates store represent1
reg candthoughtful i.dangers##i.message_overt if responrelig==1, robust
estimates store thoughtful1
reg candeloquent i.dangers##i.message_overt if responrelig==1, robust
estimates store eloquent1
coefplot support1 qualified1 represent1 thoughtful1 eloquent1, drop(_cons) xline(0) levels(90) graphregion(fcolor(white)) ylab(,nogrid)

*Table 1: Effects of Dangers Prime on Overtly Religious Message on Candidate Evaluations
reg candqualified i.dangers##i.message_overt if responrelig==1, robust
reg candqualified i.dangers##i.message_overt if responrelig==0, robust
reg candrepresent i.dangers##i.message_overt if responrelig==1, robust
reg candrepresent i.dangers##i.message_overt if responrelig==0, robust
reg candthoughtful i.dangers##i.message_overt if responrelig==1, robust
reg candthoughtful i.dangers##i.message_overt if responrelig==0, robust

**Figure 6 (revised): Reactions to the Overtly Religious Message After Dangers Prime, Among the Non-Religious***
reg candsupport i.dangers##i.message_overt if responrelig==0, robust
estimates store support1
reg candqualified i.dangers##i.message_overt if responrelig==0, robust
estimates store qualified1
reg candrepresent i.dangers##i.message_overt if responrelig==0, robust
estimates store represent1
reg candthoughtful i.dangers##i.message_overt if responrelig==0, robust
estimates store thoughtful1
reg candeloquent i.dangers##i.message_overt if responrelig==0, robust
estimates store eloquent1
coefplot support1 qualified1 represent1 thoughtful1 eloquent1, drop(_cons) xline(0) levels(90) graphregion(fcolor(white)) ylab(,nogrid)

*********************************************
**Appendix Tables and Figures from Study 1***
*********************************************
**Table D.2: Figure 5 Full Results
reg candsupport i.dangers##i.message_overt democratpid republicanpid if responrelig==1, robust
reg candqualified i.dangers##i.message_overt democratpid republicanpid if responrelig==1, robust
reg candrepresent i.dangers##i.message_overt democratpid republicanpid if responrelig==1, robust
reg candthoughtful i.dangers##i.message_overt democratpid republicanpid if responrelig==1, robust
reg candeloquent i.dangers##i.message_overt democratpid republicanpid if responrelig==1, robust

**Table D.3 Effect of Dangers Treatment on Candidate Evaluations Among Religious Respondents, Using `Any Hours Spent During the Week' as an Indicator of Religiosity
reg candsupport i.dangers##i.message_overt democratpid republicanpid if somehoursreligious==1, robust
reg candqualified i.dangers##i.message_overt democratpid republicanpid if somehoursreligious==1, robust
reg candrepresent i.dangers##i.message_overt democratpid republicanpid if somehoursreligious==1, robust 
reg candthoughtful i.dangers##i.message_overt democratpid republicanpid if somehoursreligious==1, robust 
reg candeloquent i.dangers##i.message_overt democratpid republicanpid if somehoursreligious==1, robust 

**Table D.4 Figure 6, Full Results, Non-Religious Respondents 
reg candsupport i.dangers##i.message_overt democratpid republicanpid if responrelig==0, robust
reg candqualified i.dangers##i.message_overt democratpid republicanpid if responrelig==0, robust
reg candrepresent i.dangers##i.message_overt democratpid republicanpid if responrelig==0, robust
reg candthoughtful i.dangers##i.message_overt democratpid republicanpid if responrelig==0, robust
reg candeloquent i.dangers##i.message_overt democratpid republicanpid if responrelig==0, robust

**Table D.5: Effects of Dangers Prime on Candidate Evaluations Following the Overtly Religious Message, Among Democrats Who Attend Church Every Week
reg candsupport i.dangers##i.message_overt if mostreligious==1 & democratpid==1, robust
reg candqualified i.dangers##i.message_overt if mostreligious==1 & democratpid==1, robust
reg candrepresent i.dangers##i.message_overt if mostreligious==1 & democratpid==1, robust
reg candthoughtful i.dangers##i.message_overt if mostreligious==1 & democratpid==1, robust
reg candeloquent i.dangers##i.message_overt if mostreligious==1 & democratpid==1, robust

** Table D.6: Effects of Dangers Prime on Candidate Evaluation Following the Overtly Religious Message, Among Republicans Who Attend Church Every Week
reg candsupport i.dangers##i.message_overt if mostreligious==1  & republicanpid==1, robust
reg candqualified i.dangers##i.message_overt if mostreligious==1  & republicanpid==1, robust
reg candrepresent i.dangers##i.message_overt if mostreligious==1  & republicanpid==1, robust
reg candthoughtful i.dangers##i.message_overt if mostreligious==1  & republicanpid==1, robust
reg candeloquent i.dangers##i.message_overt if mostreligious==1  & republicanpid==1, robust

**Table D.7: Effects of Dangers Prime on Candidate Evaluation Following the Overtly REligious Message, Among Democrats Who Do Not Attend Church Every Week
reg candsupport i.dangers##i.message_overt if mostreligious==0 & democratpid==1, robust
reg candqualified i.dangers##i.message_overt if mostreligious==0 & democratpid==1, robust
reg candrepresent i.dangers##i.message_overt if mostreligious==0 & democratpid==1, robust
reg candthoughtful i.dangers##i.message_overt if mostreligious==0 & democratpid==1, robust
reg candeloquent i.dangers##i.message_overt if mostreligious==0 & democratpid==1, robust

** Table D.8: Effects of Dangers Prime on Candidate Evaluation Following the Overtly Religious Message, Among Republicans Who Do Not Attend Church Every Week
reg candsupport i.dangers##i.message_overt if mostreligious==0 & republicanpid==1, robust
reg candqualified i.dangers##i.message_overt if mostreligious==0 & republicanpid==1, robust
reg candrepresent i.dangers##i.message_overt if mostreligious==0 & republicanpid==1, robust
reg candthoughtful i.dangers##i.message_overt if mostreligious==0 & republicanpid==1, robust
reg candeloquent i.dangers##i.message_overt if mostreligious==0 & republicanpid==1, robust

**Figure D.2 Relationship between Christian Nationalism and Partisan Identification
graph box cnat, over(pid_reordered) graphregion(fcolor(white)) ytitle("Christian Nationalism") ylab(,nogrid) 

**Figure D.3 Relationship between Religiosity and Partisan Identification
graph box oftenservices_reordered, over(pid_reordered) graphregion(fcolor(white)) ytitle("Religious Attendance") ylab(,nogrid) 

**Table D.12 Complier Average Causal Effects of Dangers Prime on Support for Candidates Delivering an Overtly Religious Message, Religious Respondents, in First Experiment
*ssc install ivreg2 
ivreg2 candsupport (i.compliance_dangers##i.message_overt=i.dangers##i.message_overt) i.message_overt republicanpid independentpid childrelig if responrelig==1, robust
ivreg2 candqualified (i.compliance_dangers##i.message_overt=i.dangers##i.message_overt) i.message_overt republicanpid independentpid childrelig  if responrelig==1, robust
ivreg2 candrepresent (i.compliance_dangers##i.message_overt=i.dangers##i.message_overt) i.message_overt republicanpid independentpid childrelig  if responrelig==1, robust
ivreg2 candthoughtful (i.compliance_dangers##i.message_overt=i.dangers##i.message_overt) i.message_overt republicanpid independentpid childrelig  if responrelig==1, robust
ivreg2 candeloquent (i.compliance_dangers##i.message_overt=i.dangers##i.message_overt) i.message_overt republicanpid independentpid childrelig  if responrelig==1, robust


****Figure 1*****************
gen experiment=1

append using "/Users/gwynethmcclendon/Dropbox/Paper AA-GM/Replication materials Overtly Religious Appeals JOP/anes_2016_recoded.dta", nolabel nonotes

label var democratpid Democrat
label var republicanpid Republican
label var independentpid Independent
label var white White
label var asian Asian
label var black Black
label var nativeamerican "Native American"
label var latino Latino
label var female Female
label var northeast Northeast
label var midwest Midwest
label var south South
label var west West

set scheme s2color

forv s = 0/1 {
			mean democratpid republicanpid independentpid white asian black nativeamerican latino female college northeast midwest south west if experiment==`s'
		estimate store m_`s'
}

coefplot m_0 m_1, graphregion(fcolor(white)) plotlabels("ANES 2016" "Experiment") levels(95)










